package com.lgs.demo.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.lgs.demo.R;
import com.lgs.demo.base.BaseLazyFragment;
import com.lgs.demo.bean.PackData;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by lgs on 2018/1/28.
 */
public class NextFragment extends BaseLazyFragment {

    @BindView(R.id.tv_show)
    TextView tvShow;
    HomeFragment homeFragment;

    public void setFragment(HomeFragment homeFragment) {
        this.homeFragment = homeFragment;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_next;
    }

    public static NextFragment newInstance() {
        return new NextFragment();
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
    }

    @OnClick(R.id.tv_click)
    public void click() {
        Toast.makeText(getContext(), "点击了", Toast.LENGTH_SHORT).show();
        Log.i("xxx", homeFragment + "");
        if (null != homeFragment) {
            MainActivity activity = (MainActivity) getActivity();
            activity.pushFragment(R.id.fmContainer, new HomeFragment(), true);
            activity.getmPass().setData(new PackData("XXX", 11));
        }
    }
}
